// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()


const db = cloud.database()//链接数据库
const _ = db.command

// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()

  const { OPENID } = cloud.getWXContext()
  const userCollection = db.collection('user')//选取数据库
  const thisID = userCollection.where({ '_openid': OPENID })

  try {
    return await db.collection('A-ku').where({
      _openid: OPENID,
      COR:0
    }).remove()
  } catch (e) {
    console.error(e)
  }
}